<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改店铺广告')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-advShow-edit" th:object="${advShow}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">广告标题：</label>
                <div class="col-sm-8">
                    <input name="advTitle" th:field="*{advTitle}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">位置：</label>
                <div class="col-sm-8">
                    <input name="seatId" th:field="*{seatName}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">店铺：</label>
                <div class="col-sm-8">
                    <input name="shopId" th:field="*{shopName}" class="form-control" type="text" disabled>
                </div>
            </div>
            <div class="form-group" >
                <label class="col-sm-3 control-label">宣传图片：</label>
                <input  th:field="*{imgUrls}"  type="text" id="oldImg" hidden>
                <div class="col-sm-8">
                    <input name="imgUrls" class="form-control" type="file" id="imgUrls" disabled>
                </div>
            </div>
            <div class="form-group" >
                <label class="col-sm-3 control-label">开始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="startTime" th:value="${#dates.format(advShow.startTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
                    </div>
                </div>
            </div>
            <div class="form-group" >
                <label class="col-sm-3 control-label">结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="endTime" th:value="${#dates.format(advShow.endTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">确认状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box">
                        <input type="radio" name="text1" th:value="1" th:text="通过">
                    </div>
                    <div class="radio-box">
                        <input type="radio" name="text1" th:value="2" th:text="驳回">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <script type="text/javascript">
        var prefix = ctx + "advShow/advShow";
        $("#form-advShow-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-advShow-edit').serialize());
            }
        }

        $("input[name='startTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='endTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

    $(function () {
        var Imgs = $("#oldImg").val();
        var imgArray = []
        imgArray.push(ctx + Imgs);

        $("#imgUrls").fileinput('destroy');
        $("#imgUrls").fileinput({
            language: 'zh', //设置语言
            uploadUrl: "upload/insert", //上传的地址
            allowedFileExtensions: ['jpg', 'gif', 'png', 'mp3'],//接收的文件后缀
            uploadAsync: false, //默认异步上传
            minFileCount: 1,
            maxFileCount: 5,
            showUpload: false, //是否显示上传按钮
            showRemove: true, //显示移除按钮
            showPreview: true, //是否显示预览
            showCaption: true,//是否显示标题
            browseClass: "btn btn-primary", //按钮样式
            initialPreviewAsData: true,
            initialPreviewFileType: 'image',
            initialPreview: imgArray,
            enctype: 'multipart/form-data',
            validateInitialCount: true
        });
    })


    </script>
</body>
</html>